import 'dart:convert';

import 'package:http/http.dart' as http;

import 'package:zz_blog/model/entity/hitokoto.dart';

///
/// 公共请求
///
/// @author zzzz1997
/// @created_time 20190905
///
class CommonService {
  ///
  /// 获取一言
  ///
  static Future<Hitokoto> getHitokoto() async {
    try {
      return Hitokoto.fromJson(
          jsonDecode((await http.get('https://v1.hitokoto.cn')).body));
    } catch (e) {
      throw e;
    }
  }
}
